#!/bin/bash

echo "Checking storage classes..."
kubectl get storageclass

echo -e "\nChecking PVs..."
kubectl get pv

echo -e "\nChecking MySQL deployment status..."
kubectl get pods -l app=mysql

echo -e "\nChecking PVC status..."
kubectl get pvc mysql-pvc

echo -e "\nChecking events..."
kubectl get events --sort-by=.metadata.creationTimestamp

echo -e "\nChecking pod logs (if pod exists)..."
POD_NAME=$(kubectl get pods -l app=mysql -o jsonpath="{.items[0].metadata.name}" 2>/dev/null)
if [ ! -z "$POD_NAME" ]; then
  echo "Pod logs:"
  kubectl logs $POD_NAME
else
  echo "No MySQL pod found"
fi

echo -e "\nChecking service status..."
kubectl get svc mysql-service
kubectl get svc mysql-nodeport-service